package cn.lzx.web;

import cn.lzx.domain.User;
import cn.lzx.transaction.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lizhenxing on 2017/8/4.
 */
@RestController
public class UserController {

    @Autowired
    private UserService userService;


    @RequestMapping(value = "/user", method = RequestMethod.GET)
    public User getUser(String identity) {
        return userService.getUser(identity);
    }

    @RequestMapping(value = "/user",method = RequestMethod.POST)
    public Object saveUser(@RequestBody  User user){
        userService.save(user);
        return ResponseEntity.ok().build();
    }
}
